<template>
  <div class="ChildPage TablePage" v-loading="loading">
    <vb-page ref="page">
      <template #headerBtn="scope">
        <el-button size="small" icon="el-icon-plus" type="primary" @click="gotoDetail()">新增</el-button>
      </template>
      <template #table-handle-prepend="scope">
        <el-button size="mini" type="text" icon="el-icon-edit" @click="gotoDetail(scope.row.billNo)">查看</el-button>
        <el-button size="mini" type="text" style="color:var(--el-color-success)" icon="el-icon-share" @click="toExport(scope.row.billNo)">导出</el-button>
      </template>
      <template #headerSearch-append="scope">

      </template>

      <template #table-count="scope">
        {{ scope.row.count? Number(scope.row.count.toFixed(6)): scope.row.count }}
      </template>

    </vb-page>
  </div>
</template>

<script>
export default {
  data() {
    return {
      materialLoading: false,
      materialList: [],
    }
  },
  async mounted() {

  },
  methods: {
    async getMaterialList(val) {
      if (!val) {
        this.materialList = []
        return
      }
      this.materialLoading = true
      try {
        const res = await this.callApi('get_material_by_key', { key: val, pageSize: 20 })
        if (!res.res) return
        this.materialList = res.data
      } finally {
        this.materialLoading = false
      }
    },
    toExport(billNo) {
      window.open(import.meta.env.VITE_EXPORT_URL + `otherOutApplyExport?billNo=${ billNo}`)
    },

    gotoDetail(billNo = '') {
      let url = '/other/otherOutApplyDetail'
      if (billNo ) {
        url += `?billNo=${ billNo }`
      }
      this.$router.push(url)
    }
  }
}
</script>

<style scoped>

</style>
